package com.jiepu.daily.corejava.advanceed.part8xml;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

/**
 * @Description:
 * @author: xinjie
 * @date: 2020/8/14  17:02
 */
public class SAXDemo {
	public static void main(String[] args) throws ParserConfigurationException, SAXException {
		// factory
		// 1. 获取factory实例
		SAXParserFactory factory = SAXParserFactory.newInstance();
		//2. SAX解析器
		SAXParser parser = factory.newSAXParser();
		//3. 开始解析
	//	parser.parse(f,dh);



	} // main
	class 	MyHandler extends DefaultHandler{

		public MyHandler() {
			super();
		}

		@Override
		public void startDocument() throws SAXException {
			super.startDocument();
		}

		@Override
		public void endDocument() throws SAXException {
			super.endDocument();
		}

		@Override
		public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
			System.out.println("Element...");
			super.startElement(uri, localName, qName, attributes);

		}

		@Override
		public void endElement(String uri, String localName, String qName) throws SAXException {
			super.endElement(uri, localName, qName);
		}

		@Override
		public void characters(char[] ch, int start, int length) throws SAXException {
			super.characters(ch, start, length);
		}
	}//


}
